package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.TicketDetail;
import cn.wolfcode.luowowo.article.mapper.TicketDetailMapper;
import cn.wolfcode.luowowo.article.service.ITicketDetailService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigDecimal;
import java.util.List;

@Service
public class TicketDetailServiceImpl implements ITicketDetailService {

    @Autowired
    private TicketDetailMapper ticketDetailMapper;

    @Override
    public void save(TicketDetail ticketDetail) {
        ticketDetailMapper.insert(ticketDetail);
    }

    @Override
    public void delete(Long ticketDetailId) {
        ticketDetailMapper.deleteByPrimaryKey(ticketDetailId);
    }

    @Override
    public void update(TicketDetail ticketDetail) {
        ticketDetailMapper.updateByPrimaryKey(ticketDetail);
    }

    @Override
    public TicketDetail get(Long ticketDetailId) {
        return ticketDetailMapper.selectByPrimaryKey(ticketDetailId);
    }

    @Override
    public List<TicketDetail> list() {
        return ticketDetailMapper.selectAll();
    }

    @Override
    public List<TicketDetail> listByPrimaryKey(Long ticketId, int type) {
        return ticketDetailMapper.listByPrimaryKey(ticketId, type);
    }

    @Override
    public BigDecimal minPrice(Long ticketId) {
        return ticketDetailMapper.minPrice(ticketId);
    }
}
